package com.donleo.alipay.config;

import java.io.FileWriter;
import java.io.IOException;

/**
 * 类名：AlipayConfig
 * 功能：基础配置类
 * 详细：设置帐户有关信息及返回路径
 * 修改日期：2017-04-05
 * 说明：
 * 以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 * 该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */
public class AlipayConfig {

//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

    // 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
    public static String app_id = "2021000117617851";

    // 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCMm2e/EsblAC8DSH1sb6DEE0xqgWLaE5U3G4qnS3jFDbR87fUSv0g4j6DLt09f+73tY3sIoMEVY7OukEfLpcaLaTJZiloBx2gZWRXfkodBlOScLK9aWzFxD6GbBfgorKPwkmbbYSYBIwO7CpOViW5bibue2jHx8cfkJpoPhW1BbO9moVzq7WupRd+D6pHG2PSZZ7JzCvTUqNYbiw4M2ugOJiDKmI89EP+l71Wbc+5P2v5Y15GmNv+mAJI71scO39F2CZgl0v4pHwGxxF7RDPNCpayvrz2ALjvM2WVQB8UVPhdUk5YvHO++lIXvungbsgfcoEUYlNnSqvJ7my2DdhivAgMBAAECggEATErmeB7QHOGEoNtscrH/IWT3SbL62ClYBZbEHRIubX2KOV9EYu+3WDlWnjLQttv5qh0YXQ4ctmZq0IUo7677lBl4YG1ZeS2hpl9YJv9ytHr9sF/upbBlm1tH7L3IcQl7ysUlWlPUMzm0hICwo6r2XmTVkNQD1avDMmBfp5xWM/EBqiWZGpf7n+iEQElh3LTmHxCE7nXxY0CehD+Mv896XM0Zcs4oO8BvX7QIKCV+BXrZaQHtGsogm1CgnsR9ngft8751grWUIMbA2ej4vvl0Ir0wGrp9DuoTt4YVXN8wl9wFFwZ3X/2zTFAfbTcxwXYaFeCrmdRfsCNGI4Z94p4AgQKBgQDH2eXWE6gVbZNUme0l7QpqrzljVjsGNrQiwFrkhOmhKugRlbjnuZuAPHPbwgBGaTuW3Wq+xCSiWZOoLOWvs2Agp+Vj4ERLFrkxlRtPLuIA7yu3PfV5g8/uM/iuL0dfgMzsPfx02B6jNz+nVT/WCVBGWxkQx84VZm/2raWYoN2UpwKBgQC0HG6PMMMh4dKmQ8tM0nGfBdXRVlOl3mNEHAXTB/+aFBXBzXCX8yBpH2S6UsJXP+Kfff4k3H2iqJ9lFLjKoCrFKqlKyDaXRDHaPlbMp0cWSpj7FsSYNIcPU+0exhFVOveco6rH6MgjVdWtfvWoofY0X/1CSubzYtJK1JtS0XZ0uQKBgQCTt8p7brIJjKGeodu48bmGW5gGhcFA+YQyP42vZVKuruEzxkAS/40hvw0//OhpIvVJsMVq1d3iJmXOo8juEp7V5GPYa/burZAbRwQVhijE2gOtAN4FgFlbzwxb61RNEg3l/HczAl+68mZZT9jMYrv0FPe1AIqiJMJTScyhwR2m9wKBgBOPJt578CTkzihqIlDEZbxcON0T39+aZ/NEi8lgC/zig35ZXgnSSEnCNAEb7ajl8ilZ2FiObUJVx4GFn4+5lwt0V5Acb/k7WaKWtHxjChA8p6JU1aKlyaj7dzupTMaRscQb7fbpq5pSvvKpX+ohNIh5iBpD4hK6P5YKwpda0d9ZAoGBALp91PRC60mFeDQaGmolx2XBLCKKDkbmoNvoN9cbynCVoLjyWPFNWleKL7XJZpERe4NDwsJ/UYyjc/+hqdD2KMOxicwoLZNhCLc0rSZK2h8XFNiIaPlQmsisqN7zeVuXhZYlt2HUzPL93v3fHriC2HgC/NQKp57u9DufX94M3wjT";

    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtSxTHlIx6Rv2xgHvbjRORJajWRCAZVlPL/86tRFPafBNuzJouRlIGalOxCaIj6EyT7J+uDT2YjQH+TU+2D8p3AsXUssY9V9WOuPGrL2/jEUpnCDN3h0VJ4yx2lKpzODTAoaB4YHJgXHCdQohuj9vYt7QisZ9RyroMcQb1ingCt8so0RRxOXQcx7nhaqwPxY3HkS0zhOgr+PbrtZ32ldcmr5VF09CeDhPvt/UtnHrmnDma+G5d50tLgNzlqxT7E2pFlyHo/hzyp7ZiHn3Lz1Q6Sz2H/x8Irq9PAEMoon1wv32Hhjbys5blmeUo+5D55C8Ztr7dQnljmqFb6Xl/MKO1wIDAQAB";

    // 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String notify_url = "http://donleo.free.idcfengye.com/alipay/notifyPay";

    // 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String return_url = "http://donleo.free.idcfengye.com/alipay/returnPay";

    // 签名方式
    public static String sign_type = "RSA2";

    // 字符编码格式
    public static String charset = "utf-8";

    // 支付宝网关
    public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";

    // 支付宝网关
    public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     *
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis() + ".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}
